import {
  Controller,
  Get,
  Post,
  Put,
  Body,
  Param,
  ParseIntPipe,
} from '@nestjs/common';
import { ResumeService } from './resume.service';
import { ResumeFile } from './resume.entity';

@Controller('resumes')
export class ResumeController {
  constructor(private readonly resumeService: ResumeService) {}

  @Get()
  findAll(): Promise<ResumeFile[]> {
    return this.resumeService.findAll();
  }

  @Post()
  create(
    @Body() resume: Omit<ResumeFile, 'id' | 'createdAt'>,
  ): Promise<ResumeFile> {
    return this.resumeService.create(resume);
  }

  @Put(':id')
  update(
    @Param('id', ParseIntPipe) id: number,
    @Body() resume: Partial<ResumeFile>,
  ): Promise<ResumeFile> {
    return this.resumeService.update(id, resume);
  }
}
